import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

/*1.state在vuex中用于存储数据*/
var state = {

  token: '',
  pdetail:{},
  users:{},
  active:0,
  href:0,
  node:[],
  nodeuser:[],
}
/*1.state在vuex中用于存储方法*/
var mutations = {

  changeactive(state,res){
    console.log(state)
    console.log(res)
    state.token = res
  },
  // 项目详情
  changepdetail(state,req){
    state.pdetail = req
  },
  // 项目详情
  changeusers(state,req){
    state.users = req
  },
  //项目详情跟用户详情切换
  changeactive(state,req){
    state.active = req
  },
  //顶部导航切换
  changehref(state,req){
    state.href = req
  },
  //节点操作
  changenode(state,req){
    state.node = req
  },
  //节点用户操作
  changenodeuser(state,req){
    state.nodeuser = req
  },
}

const store = new Vuex.Store({
  state,
  mutations
})

export default store;